package blog.service.impl.back;

import blog.dao.back.BlogBackMapper;
import blog.dao.back.ConsumerBackMapper;
import blog.entity.Blog;
import blog.entity.Consumer;
import blog.service.back.BlogBackService;
import blog.vo.back.*;
import blog.vo.common.PaginationVO;
import cn.hutool.core.bean.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 　　* @description: TODO
 * 　　* @param
 * 　　* @return
 * 　　* @throws
 * 　　* @author Administrator
 * 　　* @date $ $
 *
 */
@Service
public class BlogBackServiceImpl implements BlogBackService {
    @Autowired
    private BlogBackMapper blogBackMapper;

    @Override
    public List<BlogVO> getAllBlogInfo(PaginationVO paginationVO) {
        return blogBackMapper.getAllBlogInfo(paginationVO.getPageNum(), paginationVO.getPageSize());

    }

    @Override
    public List<BlogVO> getAllHighlightBlogInfo(PaginationVO paginationVO) {
        return blogBackMapper.getAllHighlightBlogInfo(paginationVO.getPageNum(), paginationVO.getPageSize());
    }

    @Override
    public List<BlogVO> getAllRootHighlightBlogInfo(PaginationVO paginationVO) {
        return blogBackMapper.getAllRootHighlightBlogInfo(paginationVO.getPageNum(), paginationVO.getPageSize());
    }

    @Override
    public List<BlogVO> likeBlogTitleGetAllNoneHighlightBlogInfo(LikeBlogTitleGetAllNoneHighlightBlogInfoVO likeBlogTitleGetAllNoneHighlightBlogInfoVO) {
        return blogBackMapper.likeBlogTitleGetAllNoneHighlightBlogInfo(likeBlogTitleGetAllNoneHighlightBlogInfoVO);
    }

    @Override
    public List<BlogVO> byTagUuidGetNoneHighlightBlogInfo(ByTagUuidGetNoneHighlightBlogInfoVO byTagUuidGetNoneHighlightBlogInfoVO) {
        return blogBackMapper.byTagUuidGetNoneHighlightBlogInfo(byTagUuidGetNoneHighlightBlogInfoVO);
    }

    @Override
    public List<BlogVO> byHighlightGetBlogInfo(ByHighlightGetBlogInfoVO byHighlightGetBlogInfoVO) {
        return blogBackMapper.byHighlightGetBlogInfo(byHighlightGetBlogInfoVO);
    }

    @Override
    public List<BlogVO> byBlogHighlightAndStatusGetBlogInfo(ByBlogHighlightAndStatusGetBlogInfo byBlogHighlightAndStatusGetBlogInfo) {
        return blogBackMapper.byBlogHighlightAndStatusGetBlogInfo(byBlogHighlightAndStatusGetBlogInfo);
    }

    @Override
    public BlogVO byBlogUuidGetNoneHighlightBlogInfo(ByBlogUuidGetNoneHighlightBlogInfoVO byBlogUuidGetNoneHighlightBlogInfoVO) {
        Blog blog = BeanUtil.copyProperties(byBlogUuidGetNoneHighlightBlogInfoVO, Blog.class);
        return blogBackMapper.byBlogUuidGetNoneHighlightBlogInfo(blog);
    }

    @Override
    public String addRootHighlightBlog(AddRootHighlightBlogVO addRootHighlightBlogVO) {
        Blog blog = BeanUtil.copyProperties(addRootHighlightBlogVO, Blog.class);
        blogBackMapper.addRootHighlightBlog(blog);
        return blog.getBlogUuid();
    }

    @Override
    public int byBlogUuidUpdateBlogInfo(ByBlogUuidUpdateBlogInfoVO byBlogUuidUpdateBlogInfoVO) {
        Blog blog = BeanUtil.copyProperties(byBlogUuidUpdateBlogInfoVO, Blog.class);
        return blogBackMapper.byBlogUuidUpdateBlogInfo(blog);
    }

    @Override
    public int byBlogUuidUpdateBlogStatus(ByBlogUuidUpdateBlogStatusVO byBlogUuidUpdateBlogStatusVO) {
        Blog blog = BeanUtil.copyProperties(byBlogUuidUpdateBlogStatusVO, Blog.class);
        return blogBackMapper.byBlogUuidUpdateBlogStatus(blog);
    }

}
